home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 037a / tpfast40.zip / TPFVIDEO.ASM < prev    next >
Assembly Source File  |  1991-11-14  |  79KB  |  1,618 lines

  1. ;   _______________________________________________________________
  2. ;  |                                                               |
  3. ;  |            CopyRight (c) 1990,1991  Steven Lutrov             |
  4. ;  |_______________________________________________________________|____
  5. ;  |                                                               |    |
  6. ;  |  program title : fastscr.asm                                  |    | ___
  7. ;  |  author        : Steven Lutrov                                |    |    |
  8. ;  |  revision      : 4.00                                         |    |    |
  9. ;  |  date          : 1991-11-01                                   |    |    |
  10. ;  |  language      : turbo assembler                              |    |    |
  11. ;  |                                                               |    |    |
  12. ;  |  description   : assembly functions for primitive screen      |    |    |
  13. ;  |                : manipulation .                               |    |    |
  14. ;  |                : tested with turbo pascal 6.0                 |    |    |
  15. ;  |                                                               |    |    |
  16. ;  |_______________________________________________________________|    |    |
  17. ;      |                                                                |    |
  18. ;      |________________________________________________________________|    |
  19. ;          |                                                                 |
  20. ;          |_________________________________________________________________|
  21. ;
  22.  
  23.  
  24. code    segment word  public
  25.  
  26. assume  cs:code,ds:data
  27.  
  28.  
  29. public background,blinkoff,blinkon,clearpage,colourx
  30. public cursordown,cursorleft,cursorright,cursoroff,cursoron,cursorup
  31. public dsp,dspat,dspcolour,dspend,dspjust,dsplncolour,dspln,dsppart
  32. public dspvert,foreground,formatleft,formatright,getcolour,getpage
  33. public intenseoff,intenseon,normal,reverse,rowcolour,setcolour,setpage
  34. public screencolour,swappage
  35.  
  36.  
  37. ;-------------------------------------------------------------------------------
  38. ;                       local subroutine called by dspend
  39. ;-------------------------------------------------------------------------------
  40. writeit proc
  41.                 push dx                 ;save dx
  42.                 mov  dx,es              ;get video buffer address
  43.                 cmp  byte ptr[bp+10],0  ;protect against snow?
  44.                 je   writeitc9          ;jump ahead if not
  45.                 mov  dx,3dah            ;status byte address
  46.                 mov  bx,ax              ;save char-attri in bx
  47. writeitc8:      in   al,dx              ;get status byte
  48.                 test al,1               ;test bit
  49.                 jnz  writeitc8          ;loop untill 0
  50.                 cli                     ;disable interrupts
  51. writeitc9:      in   al,dx              ;get status byte
  52.                 test al,1               ;test bit
  53.                 jz   writeitc9          ;loop untill 1
  54.                 mov  ax,bx              ;return char-attri to ax
  55. writeitc0:      stosw                   ;write the char and attri
  56.                 pop  dx                 ;restore dx and return
  57.                 ret
  58. writeit endp
  59.  
  60.  
  61. ;-------------------------------------------------------------------------------
  62. ;procedure background(code :char);
  63. ;-------------------------------------------------------------------------------
  64. ;
  65. data    segment
  66.         extrn  textattr :byte
  67. data    ends
  68. ;
  69. ;
  70. background proc far
  71.                 push bp                 ;save bp
  72.                 mov  bp,sp              ;set stack frame
  73.                 mov  al,textattr        ;get textattr
  74.                 and  al,1111b           ;turn off four high bits
  75.                 mov  bl,[bp+6]          ;get the code
  76.                 cmp  bl,97              ;lower case?
  77.                 jae  background1        ;jump ahead if so
  78.                 or   al,10000000b       ;set intensity bit
  79.                 add  bl,32              ;make it lower case
  80. background1:    sub  bh,bh              ;use bh as mask
  81.                 cmp  bl,107             ;black?
  82.                 je   background2        ;jump if so
  83.                 inc  bh                 ;increase mask value
  84.                 cmp  bl,98              ;blue?
  85.                 je   background2        ;jump if so
  86.                 inc  bh                 ;increase mask value
  87.                 cmp  bl,103             ;green?
  88.                 je   background2        ;jump if so
  89.                 inc  bh                 ;increase mask value
  90.                 cmp  bl,99              ;cyan?
  91.                 je   background2        ;jump if so
  92.                 inc  bh                 ;increase mask value
  93.                 cmp  bl,114             ;red?
  94.                 je   background2        ;jump if so
  95.                 inc  bh                 ;increase mask value
  96.                 cmp  bl,109             ;magenta?
  97.                 je   background2        ;jump if so
  98.                 inc  bh                 ;increase mask value
  99.                 cmp  bl,121             ;yellow?
  100.                 je   background2        ;jump if so
  101.                 inc  bh                 ;increase mask value
  102.                 cmp  bl,119             ;white?
  103.                 je   background2        ;jump if so
  104.                 jmp  short background3  ;else don't change colour
  105. background2:    mov  cl,4               ;shift left by four bits
  106.                 shl  bh,cl              ;make the shift
  107.                 or   al,bh              ;set the bits
  108.                 mov  textattr,al        ;change textattr
  109.                 pop  bp                 ;restore bp
  110. background3:    ret  2
  111. background endp
  112.  
  113.  
  114. ;-------------------------------------------------------------------------------
  115. ;procedure blinkoff;
  116. ;-------------------------------------------------------------------------------
  117. ;
  118. data    segment
  119.         extrn  textattr :byte
  120. data    ends
  121. ;
  122. ;
  123. blinkoff proc far
  124.                 mov  al,textattr        ;get the current colour
  125.                 and  al,01111111b       ;clear the relevant bit
  126.                 mov  textattr,al        ;set the value
  127.                 ret
  128. blinkoff endp
  129.  
  130.  
  131. ;-------------------------------------------------------------------------------
  132. ;procedure blinkon;
  133. ;-------------------------------------------------------------------------------
  134. ;
  135. data    segment
  136.         extrn  textattr :byte
  137. data    ends
  138. ;
  139. ;
  140. blinkon proc far
  141.                 mov  al,textattr        ;get the current colour
  142.                 or   al,10000000b       ;set the relevant bit
  143.                 mov  textattr,al        ;set the value
  144.                 ret
  145. blinkon endp
  146.  
  147.  
  148. ;-------------------------------------------------------------------------------
  149. ;procedure screencolour(x,y,xx,yy,colour :byte;);
  150. ;-------------------------------------------------------------------------------
  151. ;
  152. data    segment
  153.         extrn  video_buff:word
  154.         extrn  snow_check :byte
  155. data    ends
  156. ;
  157. ;
  158. screencolour proc far
  159.                 cld                     ;direction flag forward
  160.                 push bp                 ;save bp
  161.                 mov  bp,sp              ;set stack frame
  162.                 mov  ax,video_buff      ;fetch video_buff
  163.                 mov  es,ax              ;place in es
  164.                 sub  ax,ax              ;
  165.                 mov  al,[bp+12]         ;get y
  166.                 dec  ax                 ;count from 0
  167.                 mov  dl,160             ;bytes per y
  168.                 mul  dl                 ;times y
  169.                 sub  dx,dx              ;
  170.                 mov  dl,[bp+14]         ;get column
  171.                 dec  dx                 ;count from 0
  172.                 shl  dx,1               ;double for attributes
  173.                 add  ax,dx              ;add to y offset
  174.                 mov  si,ax              ;es:di pts to first char
  175.                 inc  si                 ;shift to first attribute
  176.                 sub  bx,bx              ;
  177.                 mov  bl,[bp+10]         ;xx in bx
  178.                 or   bx,bx              ;test for zero
  179.                 jz   screencol6         ;quit if zero
  180.                 sub  dx,dx              ;
  181.                 mov  dl,[bp+8]          ;y in dx
  182.                 or   dx,dx              ;test for zero
  183.                 jz   screencol6         ;quit if zero
  184.                 mov  al,[bp+6]          ;attribute in al
  185. screencol1:     mov  cx,bx              ;xx to cx as counter
  186.                 mov  di,si              ;move ptr to di
  187.                 push dx                 ;save y counter
  188. screencol2:     mov  dx,es              ;get video buffer address
  189.                 cmp  snow_check,0       ;protect against snow?
  190.                 je   screencol5         ;jump if not
  191.                 mov  dx,3dah            ;status byte address
  192.                 mov  bp,ax              ;save ax contents
  193. screencol3:     in   al,dx              ;get status byte
  194.                 test al,1               ;test bit
  195.                 jnz  screencol3         ;loop untill 0
  196.                 cli                     ;disable interrupts
  197. screencol4:     in   al,dx              ;get status byte
  198.                 test al,1               ;test bit
  199.                 jz   screencol4         ;loop untill 1
  200.                 mov  ax,bp              ;restore ax contents
  201. screencol5:     stosb                   ;write an attribute byte
  202.                 inc  di                 ;pt to next attri byte
  203.                 loop screencol2         ;go do next attri in line
  204.                 pop  dx                 ;restore dx
  205.                 dec  dx                 ;dec y counter
  206.                 jz   screencol6         ;quit if finished
  207.                 add  si,160             ;move ptr forward 1 y
  208.                 jmp  short screencol1   ;go do next y
  209. screencol6:     pop  bp                 ;restore bp and quit
  210.                 sti                     ;reenable interrupts
  211.                 ret  10
  212. screencolour endp
  213.  
  214. ;-------------------------------------------------------------------------------
  215. ;procedure colourx(x,y,yy,colour :byte;);
  216. ;-------------------------------------------------------------------------------
  217. ;
  218. data    segment
  219.         extrn  video_buff:word
  220.         extrn  snow_check :byte
  221. data    ends
  222. ;
  223. ;
  224. colourx proc far
  225.                 push bp                 ;save bp
  226.                 mov  bp,sp              ;set stack frame
  227.                 mov  ax,video_buff      ;fetch video_buff segment
  228.                 mov  es,ax              ;es pts to buffer
  229.                 sub  ax,ax              ;
  230.                 mov  al,[bp+12]         ;get x value
  231.                 mov  di,ax              ;
  232.                 dec  di                 ;count from 0
  233.                 shl  di,1               ;double for attri bytes
  234.                 mov  al,[bp+10]         ;get y value
  235.                 dec  ax                 ;count from 0
  236.                 mov  dl,160             ;bytes per y
  237.                 mul  dl                 ;times columns
  238.                 add  di,ax              ;add y offset
  239.                 inc  di                 ;es:di pts to 1st attri
  240.                 sub  cx,cx              ;
  241.                 mov  cl,[bp+8]          ;line length in cx
  242.                 jcxz colourx5           ;quit if null
  243.                 mov  al,[bp+6]          ;attribute in al
  244.                 cld                     ;direction flag forward
  245. colourx1:       mov  dx,es              ;get video buffer address
  246.                 cmp  snow_check,0       ;protect against snow?
  247.                 je   colourx4           ;jump if not
  248.                 mov  dx,3dah            ;status byte address
  249.                 mov  bx,ax              ;save ax contents
  250. colourx2:       in   al,dx              ;get status byte
  251.                 test al,1               ;test bit
  252.                 jnz  colourx2           ;loop untill 0
  253.                 cli                     ;disable interrupts
  254. colourx3:       in   al,dx              ;get status byte
  255.                 test al,1               ;test bit
  256.                 jz   colourx3           ;loop untill 1
  257.                 mov  ax,bx              ;restore ax contents
  258. colourx4:       stosb                   ;change attri of 1 char
  259.                 add  di,159             ;move pointer to next y
  260.                 loop colourx1           ;go change next attribute
  261. colourx5:       sti                     ;enable interrupts
  262.                 pop  bp                 ;restore bp
  263.                 ret  8
  264. colourx endp
  265.  
  266. ;-------------------------------------------------------------------------------
  267. ;procedure cursordown(y :integer);
  268. ;-------------------------------------------------------------------------------
  269. ;
  270. data    segment
  271.         extrn  video_page :byte
  272. data    ends
  273. ;
  274. ;
  275. cursordown proc far
  276.                 push bp                 ;save bp
  277.                 mov  bp,sp              ;set stack frame
  278.                 mov  bh,video_page       ;get page number
  279.                 mov  ah,3               ;func to get cursor pos
  280.                 int  10h                ;y in dh, x in dl
  281.                 mov  ah,2               ;func to set cursor
  282.                 add  dh,[bp+6]          ;add offset
  283.                 cmp  dh,24              ;in range?
  284.                 jna  cursordown1        ;jump ahead if so
  285.                 mov  dh,24              ;else bottom y
  286. cursordown1:    int  10h                ;reset cursor
  287.                 pop  bp                 ;restore bp
  288.                 ret  2
  289. cursordown endp
  290.  
  291.  
  292. ;-------------------------------------------------------------------------------
  293. ;procedure cursorleft(columns :integer);
  294. ;-------------------------------------------------------------------------------
  295. ;
  296. data    segment
  297.         extrn  video_page :byte
  298. data    ends
  299. ;
  300. ;
  301. cursorleft proc far
  302.                 push bp                 ;save bp
  303.                 mov  bp,sp              ;set stack frame
  304.                 mov  bh,video_page      ;get page number
  305.                 mov  ah,3               ;func to get cursor pos
  306.                 int  10h                ;y in dh, x in dl
  307.                 mov  ah,2               ;func to set cursor
  308.                 sub  dl,[bp+6]          ;subtract offset
  309.                 cmp  dl,79              ;in range?
  310.                 jna  cursorleft1        ;jump ahead if so
  311.                 mov  dl,0               ;else left column
  312. cursorleft1:    int  10h                ;reset cursor
  313.                 pop  bp                 ;restore bp
  314.                 ret  2
  315. cursorleft endp
  316.  
  317.  
  318. ;-------------------------------------------------------------------------------
  319. ;procedure cursoroff;
  320. ;-------------------------------------------------------------------------------
  321. data    segment
  322.         extrn  startline :byte
  323.         extrn  stopline :byte
  324. data    ends
  325. ;
  326. ;
  327. cursoroff proc far
  328.                 mov  ah,3               ;func to get cursor lines
  329.                 mov  bh,0               ;page 0
  330.                 int  10h                ;ch=start, cl=stop
  331.                 mov  startline,ch       ;save startline
  332.                 mov  stopline,cl        ;save stopline
  333.                 mov  cl,0               ;make stopline 0
  334.                 mov  ch,20              ;use too-high number for startline
  335.                 mov  ah,1               ;func to set cursor lines
  336.                 int  10h                ;make cursor invisible
  337.                 ret
  338. cursoroff endp
  339.  
  340.  
  341. ;-------------------------------------------------------------------------------
  342. ;procedure cursoron;
  343. ;-------------------------------------------------------------------------------
  344. data    segment
  345.         extrn  startline :byte
  346.         extrn  stopline :byte
  347. data    ends
  348. ;
  349. ;
  350. cursoron proc far
  351.                 mov  ch,startline       ;fetch former startline
  352.                 mov  cl,stopline        ;...and stopline
  353.                 mov  ah,1               ;func to set cursor lines
  354.                 int  10h                ;make cursor invisible
  355.                 ret
  356. cursoron endp
  357.  
  358.  
  359. ;-------------------------------------------------------------------------------
  360. ;procedure cursorright(columns :integer);
  361. ;-------------------------------------------------------------------------------
  362. ;
  363. data    segment
  364.         extrn  video_page :byte
  365. data    ends
  366. ;
  367. ;
  368. cursorright proc  far
  369.                 push bp                 ;save bp
  370.                 mov  bp,sp              ;set stack frame
  371.                 mov  bh,video_page      ;get page number
  372.                 mov  ah,3               ;func to get cursor pos
  373.                 int  10h                ;y in dh, x in dl
  374.                 mov  ah,2               ;func to set cursor
  375.                 add  dl,[bp+6]          ;add offset
  376.                 cmp  dl,79              ;in range?
  377.                 jna  cursoron1          ;jump ahead if so
  378.                 mov  dl,79              ;else right column
  379. cursoron1:      int  10h                ;reset cursor
  380.                 pop  bp                 ;restore bp
  381.                 ret  2
  382. cursorright endp
  383.  
  384.  
  385. ;-------------------------------------------------------------------------------
  386. ;procedure cursorup(y :integer);
  387. ;-------------------------------------------------------------------------------
  388. ;
  389. data    segment
  390.         extrn  video_page :byte
  391. data    ends
  392. ;
  393. ;
  394. cursorup proc far
  395.                 push bp                 ;save bp
  396.                 mov  bp,sp              ;set stack frame
  397.                 mov  bh,video_page      ;get page number
  398.                 mov  ah,3               ;func to get cursor pos
  399.                 int  10h                ;y in dh, x in dl
  400.                 mov  ah,2               ;func to set cursor
  401.                 sub  dh,[bp+6]          ;subtract offset
  402.                 cmp  dh,24              ;in range?
  403.                 jna  cursorup1          ;jump ahead if so
  404.                 mov  dh,0               ;else top y
  405. cursorup1:      int  10h                ;reset cursor
  406.                 pop  bp                 ;restore bp
  407.                 ret  2
  408. cursorup endp
  409.  
  410.  
  411. ;-------------------------------------------------------------------------------
  412. ;procedure dspat(strx: stype; x,y,colour :byte;);
  413. ;-------------------------------------------------------------------------------
  414. ;
  415. data    segment
  416.         extrn  video_buff:word
  417.         extrn  video_page :byte
  418.         extrn  snow_check :byte
  419. data    ends
  420. ;
  421. ;
  422. dspat proc far
  423.                 cld                     ;direction flag forward
  424.                 push bp                 ;save bp
  425.                 mov  bp,sp              ;set stack frame
  426.                 push ds                 ;save turbo's ds
  427.                 mov  ax,video_buff      ;fetch video_buff
  428.                 mov  es,ax              ;place in es
  429.                 mov  bl,snow_check      ;fetch snow_check
  430.                 mov  bh,video_page      ;fetch video_page
  431.                 lds  si,dword ptr[bp+12] ;ds:si pts to strx
  432.                 mov  [bp+14],bx         ;save video_page and snow_check
  433.                 sub  cx,cx              ;clear cx
  434.                 mov  cl,[si]            ;string len counted in cx
  435.                 inc  si                 ;pt ds:si to first char
  436.                 sub  ax,ax              ;
  437.                 mov  al,[bp+10]         ;get x value
  438.                 mov  di,ax              ;
  439.                 mov  al,[bp+8]          ;get y value
  440.                 dec  ax                 ;count from 0
  441.                 mov  dl,160             ;bytes per y
  442.                 mul  dl                 ;times y
  443.                 dec  di                 ;count cols from 0
  444.                 shl  di,1               ;double for attributes
  445.                 add  di,ax              ;es:di pts to lst pos
  446.                 jcxz display5           ;if null, set cursor,quit
  447.                 mov  ah,[bp+6]          ;get attribute
  448. display1:       lodsb                   ;get a character
  449.                 cmp  byte ptr[bp+14],0  ;protect against snow?
  450.                 je   display4           ;jump ahead if not
  451.                 mov  dx,3dah            ;status byte address
  452.                 mov  bx,ax              ;save ah contents
  453. display2:       in   al,dx              ;get status byte
  454.                 test al,1               ;test bit
  455.                 jnz  display2           ;loop untill 0
  456.                 cli                     ;disable interrupts
  457. display3:       in   al,dx              ;get status byte
  458.                 test al,1               ;test bit
  459.                 jz   display3           ;loop untill 1
  460.                 mov  ax,bx              ;restore ah contents
  461. display4:       stosw                   ;write it with attribute
  462.                 loop display1           ;go do next
  463.                 sti                     ;reenable interrupts
  464. display5:       mov  bh,[bp+15]         ;video page to bh
  465.                 mov  ax,di              ;screen pointer
  466.                 shr  ax,1               ;div by 2 for attributes
  467.                 mov  cl,80              ;div by number cols
  468.                 div  cl                 ;make the division
  469.                 mov  dh,al              ;y number
  470.                 mov  dl,ah              ;x number
  471.                 mov  ah,2               ;function to set cursor
  472.                 int  10h                ;set curs to final pos
  473. display6:       pop  ds                 ;restore ds and quit                    
  474.                 pop  bp                 ;restore bp
  475.                 ret  10
  476. dspat endp
  477.  
  478.  
  479. ;-------------------------------------------------------------------------------
  480. ;procedure foreground(code :char);
  481. ;-------------------------------------------------------------------------------
  482. ;
  483. data    segment
  484.         extrn  textattr :byte
  485. data    ends
  486. ;
  487. ;
  488. foreground proc far
  489.                 push bp                 ;save bp
  490.                 mov  bp,sp              ;set stack frame
  491.                 mov  al,textattr        ;get textattr
  492.                 and  al,11110000b       ;turn off four low bits
  493.                 mov  bl,[bp+6]          ;get the code
  494.                 cmp  bl,97              ;lower case?
  495.                 jae  foreground1        ;jump ahead if so
  496.                 or   al,1000b           ;set intensity bit
  497.                 add  bl,32              ;make it lower case
  498. foreground1:    sub  bh,bh              ;use bh as mask
  499.                 cmp  bl,107             ;black?
  500.                 je   foreground2        ;jump if so
  501.                 inc  bh                 ;increase mask value
  502.                 cmp  bl,98              ;blue?
  503.                 je   foreground2        ;jump if so
  504.                 inc  bh                 ;increase mask value
  505.                 cmp  bl,103             ;green?
  506.                 je   foreground2        ;jump if so
  507.                 inc  bh                 ;increase mask value
  508.                 cmp  bl,99              ;cyan?
  509.                 je   foreground2        ;jump if so
  510.                 inc  bh                 ;increase mask value
  511.                 cmp  bl,114             ;red?
  512.                 je   foreground2        ;jump if so
  513.                 inc  bh                 ;increase mask value
  514.                 cmp  bl,109             ;magenta?
  515.                 je   foreground2        ;jump if so
  516.                 inc  bh                 ;increase mask value
  517.                 cmp  bl,121             ;yellow?
  518.                 je   foreground2        ;jump if so
  519.                 inc  bh                 ;increase mask value
  520.                 cmp  bl,119             ;white?
  521.                 je   foreground2        ;jump if so
  522.                 jmp  short foreground3  ;else don't change colour
  523. foreground2:    or   al,bh              ;set the bits
  524.                 mov  textattr,al        ;change textattr
  525.                 pop  bp                 ;restore bp
  526. foreground3:    ret  2
  527. foreground endp
  528.  
  529.  
  530. ;-------------------------------------------------------------------------------
  531. ;procedure formatleft(strx: stype; how_many :integer; colour :byte;);
  532. ;-------------------------------------------------------------------------------
  533. ;
  534. data    segment
  535.         extrn  video_buff:word
  536.         extrn  video_page :byte
  537.         extrn  snow_check :byte
  538. data    ends
  539. ;
  540. ;
  541. formatleft proc far
  542.                 cld                     ;set direction flag
  543.                 push bp                 ;save bp
  544.                 mov  bp,sp              ;set stack frame
  545.                 mov  bh,video_page      ;get bios page
  546.                 mov  ax,video_buff      ;fetch video_buff
  547.                 mov  es,ax              ;move to es
  548.                 push ds                 ;save ds
  549.                 mov  ah,3               ;bios call for curs pos
  550.                 int  10h                ;dh-dl cursor y-x
  551.                 mov  ax,160             ;bytes per y
  552.                 mul  dh                 ;times y
  553.                 sub  cx,cx              ;clear cx
  554.                 mov  cl,dl              ;cols to cx
  555.                 shl  cl,1               ;double for attributes
  556.                 add  ax,cx              ;add to y offset
  557.                 mov  di,ax              ;place offset in di
  558.                 mov  bl,snow_check     ;fetch snow_check
  559.                 lds  si,dword ptr[bp+10] ;ds:si pts to strx
  560.                 mov  byte ptr[bp+10],bl ;keep snow_check
  561.                 mov  cl,[si]            ;get strx length
  562.                 jcxz formatleft5        ;jump if null
  563.                 push dx                 ;save cursor values
  564.                 push bx                 ;save video page
  565.                 mov  bh,[bp+6]          ;attribute to bh
  566.                 inc  si                 ;forword ptr to first byte
  567. formatleft1:    mov  bl,[si]            ;get a char
  568.                 cmp  byte ptr[bp+10],0  ;protect against snow?
  569.                 je   formatleft4        ;jump if not
  570.                 mov  dx,3dah            ;status byte address
  571. formatleft2:    in   al,dx              ;get status byte
  572.                 test al,1               ;test bit
  573.                 jnz  formatleft2        ;loop untill 0
  574.                 cli                     ;disable interrupts
  575. formatleft3:    in   al,dx              ;get status byte
  576.                 test al,1               ;test bit
  577.                 jz   formatleft3        ;loop untill 1
  578. formatleft4:    mov  ax,bx              ;get char-attribute
  579.                 stosw                   ;write it
  580.                 inc  si                 ;inc strx ptr
  581.                 loop formatleft1        ;go do next char
  582.                 sti                     ;reenable interrupts
  583.                 pop  bx                 ;video page back to bh
  584.                 pop  dx                 ;restore cursor values
  585. formatleft5:    mov  cx,[bp+8]          ;get new cursor offset
  586.                 test cx,8000h           ;negative?
  587.                 jz   formatleft6        ;jump if not
  588.                 neg  cx                 ;make positive
  589.                 add  dh,cl              ;add to y offset
  590.                 cmp  dh,24              ;bottom of screen?
  591.                 jb   formatleft7        ;jump if not
  592.                 mov  dh,24              ;else edge of screen
  593.                 jmp  short formatleft7  ;to set cursor
  594. formatleft6:    add  dl,cl              ;add to x offset
  595.                 cmp  dl,79              ;off screen?
  596.                 jb   formatleft7        ;jump if not
  597.                 mov  dl,79              ;else edge of screen
  598. formatleft7:    mov  ah,2               ;bios func to set curs
  599.                 int  10h                ;set new cursor pos
  600.                 pop  ds                 ;restore ds
  601.                 pop  bp                 ;restore bp and quit
  602.                 ret  8
  603. formatleft endp
  604.  
  605.  
  606. ;-------------------------------------------------------------------------------
  607. ;procedure formatright(strx: stype; how_many :integer; colour :byte;);
  608. ;-------------------------------------------------------------------------------
  609. ;
  610. data    segment
  611.         extrn  video_buff:word
  612.         extrn  video_page :byte
  613.         extrn  snow_check :byte
  614. data    ends
  615. ;
  616. ;
  617. formatright proc far
  618.                 cld                     ;set direction flag
  619.                 push bp                 ;save bp
  620.                 mov  bp,sp              ;set stack frame
  621.                 mov  bh,video_page      ;get bios page
  622.                 mov  ax,video_buff      ;fetch video_buff
  623.                 mov  es,ax              ;move to es
  624.                 push ds                 ;save ds
  625.                 mov  ah,3               ;bios call for curs pos
  626.                 int  10h                ;dh-dl cursor y-x
  627.                 mov  ax,160             ;bytes per y
  628.                 mul  dh                 ;times y
  629.                 sub  cx,cx              ;clear cx
  630.                 mov  cl,dl              ;cols to cx
  631.                 shl  cl,1               ;double for attributes
  632.                 add  ax,cx              ;add to y offset
  633.                 mov  di,ax              ;place offset in di
  634.                 mov  bl,snow_check      ;fetch snow_check
  635.                 lds  si,dword ptr[bp+10] ;ds:si pts to strx
  636.                 mov  byte ptr[bp+10],bl ;keep snow_check
  637.                 mov  cl,[si]            ;get strx length
  638.                 jcxz formatright5       ;jump if null
  639.                 push dx                 ;save cursor values
  640.                 push bx                 ;save video page
  641.                 mov  bh,[bp+6]          ;attribute to bh
  642.                 add  si,cx              ;pt to end of strx
  643. formatright1:   mov  bl,[si]            ;get a char
  644.                 cmp  byte ptr[bp+10],0  ;protect against snow?
  645.                 je   formatright4       ;jump if not
  646.                 mov  dx,3dah            ;status byte address
  647. formatright2:   in   al,dx              ;get status byte
  648.                 test al,1               ;test bit
  649.                 jnz  formatright2       ;loop untill 0
  650.                 cli                     ;disable interrupts
  651. formatright3:   in   al,dx              ;get status byte
  652.                 test al,1               ;test bit
  653.                 jz   formatright3       ;loop untill 1
  654. formatright4:   mov  ax,bx              ;get char-attribute
  655.                 stosw                   ;write it
  656.                 sub  di,4               ;pull back scrn ptr
  657.                 dec  si                 ;dec strx ptr
  658.                 loop formatright1       ;go do next char
  659.                 sti                     ;reenable interrupts
  660.                 pop  bx                 ;video page back to bh
  661.                 pop  dx                 ;restore cursor values
  662. formatright5:   mov  cx,[bp+8]          ;get new cursor offset
  663.                 test cx,8000h           ;negative?
  664.                 jz   formatright6       ;jump if not
  665.                 neg  cx                 ;make positive
  666.                 add  dh,cl              ;add to y offset
  667.                 cmp  dh,24              ;bottom of screen?
  668.                 jb   formatright7       ;jump if not
  669.                 mov  dh,24              ;else edge of screen
  670.                 jmp  short formatright7 ;to set cursor
  671. formatright6:   add  dl,cl              ;add to x offset
  672.                 cmp  dl,79              ;off screen?
  673.                 jb   formatright7       ;jump if not
  674.                 mov  dl,79              ;else edge of screen
  675. formatright7:   mov  ah,2               ;bios func to set curs
  676.                 int  10h                ;set new cursor pos
  677.                 pop  ds                 ;restore ds
  678.                 pop  bp                 ;restore bp and quit
  679.                 ret  8
  680. formatright endp
  681.  
  682.  
  683. ;-------------------------------------------------------------------------------
  684. ;function getcolour(x,y :byte;) :byte;;
  685. ;-------------------------------------------------------------------------------
  686. ;
  687. data    segment
  688.         extrn  video_page :byte
  689. data    ends
  690. ;
  691. getcolour proc far
  692.                 push bp                 ;save bp
  693.                 mov  bp,sp              ;set stack frame
  694.                 mov  bh,video_page      ;set the page
  695.                 mov  dh,[bp+6]          ;y to dh
  696.                 dec  dh                 ;count from 0
  697.                 mov  dl,[bp+8]          ;x to dl
  698.                 dec  dl                 ;count from 0
  699.                 mov  ah,2               ;function to set cursor
  700.                 int  10h                ;set the cursor
  701.                 mov  ah,8               ;func to read attribute
  702.                 int  10h                ;colour now in ah
  703.                 mov  al,ah              ;colour to al
  704.                 sub  ah,ah              ;clear high byte
  705.                 pop  bp                 ;restore bp and quit
  706.                 ret  4
  707. getcolour endp
  708.  
  709.  
  710. ;-------------------------------------------------------------------------------
  711. ;procedure intenseoff;
  712. ;-------------------------------------------------------------------------------
  713. ;
  714. data    segment
  715.         extrn  textattr :byte
  716. data    ends
  717. ;
  718. ;
  719. intenseoff proc far
  720.                 mov  al,textattr        ;get the current colour
  721.                 and  al,11110111b       ;clear the relevant bit
  722.                 mov  textattr,al        ;set the value
  723.                 ret
  724. intenseoff endp
  725.  
  726.  
  727. ;-------------------------------------------------------------------------------
  728. ;procedure intenseon;
  729. ;-------------------------------------------------------------------------------
  730. ;
  731. data    segment
  732.         extrn  textattr :byte
  733. data    ends
  734. ;
  735. ;
  736. intenseon proc far
  737.                 mov  al,textattr        ;get the current colour
  738.                 or   al,1000b           ;set the relevant bit
  739.                 mov  textattr,al        ;set the value
  740.                 ret
  741. intenseon endp
  742.  
  743.  
  744. ;-------------------------------------------------------------------------------
  745. ;procedure normal;
  746. ;-------------------------------------------------------------------------------
  747. ;
  748. data    segment
  749.         extrn  textattr :byte
  750. data    ends
  751. ;
  752. ;
  753. normal proc far
  754.                 mov  al,textattr        ;get current setting
  755.                 and  al,10001000b       ;relevant bits off
  756.                 or   al,111b            ;relevant bits on
  757.                 mov  textattr,al        ;set new value
  758.                 ret
  759. normal endp
  760.  
  761.  
  762. ;-------------------------------------------------------------------------------
  763. ;procedure reverse;
  764. ;-------------------------------------------------------------------------------
  765. ;
  766. data    segment
  767.         extrn  textattr :byte
  768. data    ends
  769. ;
  770. ;
  771. reverse proc far
  772.                 mov  al,textattr        ;get the current colour
  773.                 and  al,10001000b       ;relevant bits off
  774.                 or   al,1110000b        ;relevant bits on
  775.                 mov  textattr,al        ;set new value
  776.                 ret
  777. reverse endp
  778.  
  779.  
  780. ;-------------------------------------------------------------------------------
  781. ;procedure rowcolour(x,y,xx,colour :byte;);
  782. ;-------------------------------------------------------------------------------
  783. ;
  784. data    segment
  785.         extrn  video_buff:word
  786.         extrn  snow_check :byte
  787. data    ends
  788. ;
  789. ;
  790. rowcolour proc far
  791.                 push bp                 ;save bp
  792.                 mov  bp,sp              ;set stack frame
  793.                 mov  ax,video_buff      ;segment of video_buff
  794.                 mov  es,ax              ;move to es
  795.                 sub  ax,ax              ;
  796.                 mov  al,[bp+12]         ;get x value
  797.                 mov  di,ax              ;
  798.                 dec  di                 ;count from 0
  799.                 mov  al,[bp+10]         ;get y value
  800.                 dec  ax                 ;count from 0
  801.                 mov  dl,160             ;bytes per y
  802.                 mul  dl                 ;times number y
  803.                 shl  di,1               ;double for attri bytes
  804.                 add  di,ax              ;add y offset
  805.                 inc  di                 ;es:di pts to 1st attri
  806.                 sub  cx,cx              ;
  807.                 mov  cl,[bp+8]          ;line length in cx
  808.                 jcxz rowcolour5         ;quit if null
  809.                 mov  al,[bp+6]          ;attribute in al
  810.                 cld                     ;direction flag forward
  811. rowcolour1:     cmp  snow_check,0       ;protect against snow?
  812.                 je   rowcolour4         ;jump if not
  813.                 mov  dx,3dah            ;status byte address
  814.                 mov  bx,ax              ;save ax contents
  815. rowcolour2:     in   al,dx              ;get status byte
  816.                 test al,1               ;test bit
  817.                 jnz  rowcolour2         ;loop untill 0
  818.                 cli                     ;disable interrupts
  819. rowcolour3:     in   al,dx              ;get status byte
  820.                 test al,1               ;test bit
  821.                 jz   rowcolour3         ;loop untill 1
  822.                 mov  ax,bx              ;restore ax contents
  823. rowcolour4:     stosb                   ;change attri of 1 char
  824.                 inc  di                 ;skip pointer over next
  825.                 loop rowcolour1         ;go change next attribute
  826. rowcolour5:     sti                     ;reenable interrupts
  827.                 pop  bp                 ;restore bp
  828.                 ret  8
  829. rowcolour endp
  830.  
  831.  
  832.  
  833. ;-------------------------------------------------------------------------------
  834. ;procedure setcolour(x,y,colour :byte;);
  835. ;-------------------------------------------------------------------------------
  836. ;
  837. data    segment
  838.         extrn  video_page :byte
  839. data    ends
  840. ;
  841. ;
  842. setcolour proc far
  843.                 push bp                 ;save bp
  844.                 mov  bp,sp              ;set stack frame
  845.                 mov  bh,video_page      ;set the page
  846.                 mov  dh,[bp+8]          ;y to dh
  847.                 dec  dh                 ;count from 0
  848.                 mov  dl,[bp+10]         ;x to dl
  849.                 dec  dl                 ;count from 0
  850.                 mov  ah,2               ;function to set cursor
  851.                 int  10h                ;set the cursor
  852.                 mov  ah,8               ;func to read attribute
  853.                 int  10h                ;char now in al
  854.                 mov  ah,9               ;function to write char
  855.                 mov  cx,1               ;write at 1 pos only
  856.                 mov  bl,[bp+6]          ;new attribute
  857.                 int  10h                ;set the new attribute
  858.                 pop  bp                 ;restore bp
  859.                 ret  6
  860. setcolour endp
  861.  
  862.  
  863. ;-------------------------------------------------------------------------------
  864. ;procedure setpage(pagenumber :integer);
  865. ;-------------------------------------------------------------------------------
  866. setpage proc far
  867.                 mov  bx,sp              ;bx pts to stack
  868.                 mov  ah,5               ;function number
  869.                 mov  al,ss:[bx+4]       ;page number
  870.                 int  10h                ;set the current page
  871.                 ret  2
  872. setpage endp
  873.  
  874.  
  875. ;-------------------------------------------------------------------------------
  876. ;procedure dspcolour(strx: stype; colour :byte;);
  877. ;-------------------------------------------------------------------------------
  878. ;
  879. data    segment
  880.         extrn  video_buff:word
  881.         extrn  video_page :byte
  882.         extrn  snow_check :byte
  883. data    ends
  884. ;
  885. ;
  886. dspcolour proc far
  887.                 push bp                 ;save bp
  888.                 mov  bp,sp              ;set stack frame
  889.                 push ds                 ;ds changed
  890.                 cld                     ;direction flag forward
  891.                 mov  ax,video_buff      ;fetch video_buff
  892.                 mov  es,ax              ;place in es
  893.                 mov  bh,video_page      ;set the cursor page
  894.                 mov  bl,snow_check      ;get snow_check
  895.                 mov  ah,3               ;bios func for cursor pos
  896.                 int  10h                ;now dh-dl holds y-x
  897.                 lds  si,dword ptr[bp+8] ;ds:si pts to strx
  898.                 mov  [bp+8],bx          ;save page number and snow_check
  899.                 sub  cx,cx              ;clear cx
  900.                 mov  cl,[si]            ;string len counted in cx
  901.                 jcxz dspc8              ;quit if null
  902.                 inc  si                 ;pt ds:si to first char
  903.                 mov  ax,160             ;byte per row
  904.                 mul  dh                 ;multiply by num rows
  905.                 sub  dh,dh              ;now dx holds num cols
  906.                 shl  dx,1               ;double for attri bytes
  907.                 add  ax,dx              ;cursor offset in buffer
  908.                 mov  di,ax              ;now es:di pts to pos
  909.                 mov  bx,3998            ;scroll if won't fit...
  910.                 sub  bx,di              ;space left
  911.                 mov  ax,cx              ;chars to be printed
  912.                 shl  ax,1               ;double for attributes
  913.                 cmp  bx,ax              ;enough room?
  914.                 jge  dspc3              ;jump ahead if so
  915.                 sub  ax,bx              ;amount space required
  916.                 mov  bl,160             ;byte per y
  917.                 div  bl                 ;divide
  918.                 cmp  ah,0               ;any remainder?
  919.                 je   dspc1              ;if not, jump ahead
  920.                 inc  al                 ;else, scroll 1 more line
  921. dspc1:          push cx                 ;save string length
  922.                 push bp                 ;scrolling changes bp
  923.                 push ax                 ;save num lines scrolled
  924.                 mov  bh,[bp+6]          ;attribute of new lines
  925.                 mov  cx,0000h           ;top left y-x
  926.                 mov  dx,184fh           ;bottom right y-x
  927.                 mov  ah,6               ;upwards scroll function
  928.                 int  10h                ;make the scroll
  929.                 pop  cx                 ;num lines scrolled in cl
  930.                 sub  ch,ch              ;clear ch, use cx counter
  931. dspc2:          sub  di,160             ;screen ptr back 1 line
  932.                 loop dspc2              ;repeat for ea ln of scrl
  933.                 pop  bp                 ;restore bp
  934.                 pop  cx                 ;restore string length
  935. dspc3:          mov  ah,[bp+6]          ;get attribute
  936. dspc4:          lodsb                   ;get a character
  937.                 mov  dx,es              ;get video buffer address
  938.                 cmp  byte ptr[bp+8],0   ;protect against show?
  939.                 je   dspc7              ;jump ahead if not
  940.                 mov  dx,3dah            ;status byte address
  941.                 mov  bx,ax              ;save ax contents
  942. dspc5:          in   al,dx              ;get status byte
  943.                 test al,1               ;test bit
  944.                 jnz  dspc5              ;loop untill 0
  945.                 cli                     ;disable interrupts
  946. dspc6:          in   al,dx              ;get status byte
  947.                 test al,1               ;test bit
  948.                 jz   dspc6              ;loop untill 1
  949.                 mov  ax,bx              ;restore ax contents
  950. dspc7:          stosw                   ;write char and attri
  951.                 loop dspc4              ;go do next
  952.                 sti                     ;reenable interrupts
  953.                 mov  ax,di              ;now set new cursor pos
  954.                 mov  dl,160             ;chars in a y
  955.                 div  dl                 ;divide scrn ptr
  956.                 shr  ah,1               ;div remainder by 2
  957.                 mov  dl,ah              ;bios: x in dl
  958.                 mov  dh,al              ;y in dh
  959.                 mov  bh,[bp+9]          ;page number
  960.                 mov  ah,2               ;function number
  961.                 int  10h                ;set the cursor
  962. dspc8:          pop  ds                 ;restore ds and quit
  963.                 pop  bp                 ;restore bp
  964.                 ret  6
  965. dspcolour endp
  966.  
  967.  
  968. ;-------------------------------------------------------------------------------
  969. ;procedure dsp(strx: stype);
  970. ;-------------------------------------------------------------------------------
  971. ;
  972. data    segment
  973.         extrn  video_buff:word
  974.         extrn  video_page :byte
  975.         extrn  snow_check :byte
  976.         extrn  textattr :byte
  977. data    ends
  978. ;
  979. ;
  980. dsp    proc far
  981.                 push bp                 ;save bp
  982.                 mov  bp,sp              ;set stack frame
  983.                 push ds                 ;ds changed
  984.                 cld                     ;direction flag forward
  985.                 mov  ax,video_buff      ;get video buffer address
  986.                 mov  es,ax              ;place it in es
  987.                 mov  al,textattr        ;get colour
  988.                 mov  ah,snow_check      ;get snow_check
  989.                 mov  bh,video_page      ;set the cursor page
  990.                 lds  si,dword ptr[bp+6] ;ds:si pts to strx
  991.                 mov  [bp+6],ax          ;save colour and snow_check
  992.                 mov  [bp+8],bh          ;save video_page
  993.                 mov  ah,3               ;bios func for cursor pos
  994.                 int  10h                ;now dh-dl holds y-x
  995.                 sub  cx,cx              ;clear cx
  996.                 mov  cl,[si]            ;string len counted in cx
  997.                 cmp  cl,0               ;null string?
  998.                 je   dspll8             ;quit if so
  999.                 inc  si                 ;now ds:si pts to strx
  1000.                 mov  ax,160             ;cursor pos :byte;s in y
  1001.                 mul  dh                 ;multiply by num y
  1002.                 sub  dh,dh              ;now dx holds num cols
  1003.                 shl  dx,1               ;double for attri bytes
  1004.                 add  ax,dx              ;cursor offset in buffer
  1005.                 mov  di,ax              ;now es:di pts to pos
  1006.                 mov  bx,3998            ;scroll if won't fit...
  1007.                 sub  bx,di              ;space left
  1008.                 mov  ax,cx              ;chars to be printed
  1009.                 shl  ax,1               ;double for attributes
  1010.                 cmp  bx,ax              ;enough room?
  1011.                 jge  dspll3             ;jump ahead if so
  1012.                 sub  ax,bx              ;amount space required
  1013.                 mov  bl,160             ;bytes in a y
  1014.                 div  bl                 ;divide
  1015.                 cmp  ah,0               ;any remainder?
  1016.                 je   dspll1             ;if not, jump ahead
  1017.                 inc  al                 ;else, scroll 1 more line
  1018. dspll1:         push cx                 ;save string length
  1019.                 push bp                 ;scrolling changes bp
  1020.                 push ax                 ;save num lines scrolled
  1021.                 mov  bh,7               ;attribute of new lines
  1022.                 mov  cx,0000h           ;top left y-x
  1023.                 mov  dx,184fh           ;bottom right y-x
  1024.                 mov  ah,6               ;upwards scroll function
  1025.                 int  10h                ;make the scroll
  1026.                 pop  cx                 ;num lines scrolled in cl
  1027.                 sub  ch,ch              ;clear ch, use cx counter
  1028. dspll2:         sub  di,160             ;screen ptr back 1 line
  1029.                 loop dspll2             ;repeat for ea ln of scrl
  1030.                 pop  bp                 ;restore bp
  1031.                 pop  cx                 ;restore string length
  1032. dspll3:         mov  ah,[bp+6]          ;get attribute
  1033. dspll4:         lodsb                   ;get a character
  1034.                 cmp  byte ptr[bp+7],0   ;protect against snow?
  1035.                 je   dspll7             ;jump ahead if not
  1036.                 mov  dx,3dah            ;status byte address
  1037.                 mov  bx,ax              ;save char/attri in bx
  1038. dspll5:         in   al,dx              ;get status byte
  1039.                 test al,1               ;test bit
  1040.                 jnz  dspll5             ;loop untill 0
  1041.                 cli                     ;disable interrupts
  1042. dspll6:         in   al,dx              ;get status byte
  1043.                 test al,1               ;test bit
  1044.                 jz   dspll6             ;loop untill 1
  1045.                 mov  ax,bx              ;restore char to ax
  1046. dspll7:         stosw                   ;write it with attribute
  1047.                 loop dspll4             ;go do next
  1048.                 sti                     ;reenable interrupts
  1049.                 mov  ax,di              ;now set new cursor pos
  1050.                 mov  dl,160             ;chars in a y
  1051.                 div  dl                 ;divide scrn ptr
  1052.                 shr  ah,1               ;div remainder by 2
  1053.                 mov  dl,ah              ;bios: x in dl
  1054.                 mov  dh,al              ;y in dh
  1055.                 mov  bh,[bp+8]          ;page number
  1056.                 mov  ah,2               ;function number
  1057.                 int  10h                ;set the cursor
  1058. dspll8:         pop  ds                 ;restore ds and quit
  1059.                 pop  bp                 ;restore bp
  1060.                 ret  4
  1061. dsp    endp
  1062.  
  1063.  
  1064. ;-------------------------------------------------------------------------------
  1065. ;procedure dspln(strx: stype);
  1066. ;-------------------------------------------------------------------------------
  1067. ;
  1068. data    segment
  1069.         extrn  video_buff:word
  1070.         extrn  video_page :byte
  1071.         extrn  snow_check :byte
  1072.         extrn  textattr :byte
  1073. data    ends
  1074. ;
  1075. ;
  1076. dspln  proc far
  1077.                 push bp                 ;save bp
  1078.                 mov  bp,sp              ;set stack frame
  1079.                 push ds                 ;ds changed
  1080.                 cld                     ;direction flag forward
  1081.                 mov  ax,video_buff      ;get video buffer address
  1082.                 mov  es,ax              ;place in es
  1083.                 mov  al,textattr        ;get colour value
  1084.                 mov  ah,snow_check      ;get snow_check
  1085.                 mov  bh,video_page      ;set the cursor page
  1086.                 lds  si,dword ptr[bp+6] ;ds:si pts to strx
  1087.                 mov  [bp+8],bh          ;save page numberzz
  1088.                 mov  [bp+6],ax          ;save colour and snow_check
  1089.                 mov  ah,3               ;bios func for cursor pos
  1090.                 int  10h                ;now dh-dl holds y-x
  1091.                 sub  cx,cx              ;clear cx
  1092.                 mov  cl,[si]            ;string len counted in cx
  1093.                 inc  si                 ;now ds:si pts to strx
  1094.                 mov  ax,160             ;cursor pos :byte;s in y
  1095.                 mul  dh                 ;multiply by num y
  1096.                 sub  dh,dh              ;now dx holds num cols
  1097.                 shl  dx,1               ;double for attri bytes
  1098.                 add  ax,dx              ;cursor offset in buffer
  1099.                 mov  di,ax              ;now es:di pts to pos
  1100.                 mov  bx,3840            ;scrl if won't fit y 24
  1101.                 sub  bx,di              ;space left
  1102.                 mov  ax,cx              ;chars to be printed
  1103.                 shl  ax,1               ;double for attributes
  1104.                 or   cx,cx              ;test for null string
  1105.                 jnz  dspline1           ;jump if not null
  1106.                 cmp  di,3840            ;last y?
  1107.                 jnge dspline1           ;jump if not
  1108.                 mov  al,1               ;scroll if null on y 25
  1109.                 jmp  short dspline2     ;jump ahead
  1110. dspline1:       cmp  bx,ax              ;enough room?
  1111.                 jge  dspline4           ;jump ahead if so
  1112.                 sub  ax,bx              ;amount space required
  1113.                 mov  bl,160             ;bytes in a y
  1114.                 div  bl                 ;divide
  1115.                 cmp  ah,0               ;any remainder?
  1116.                 je   dspline2           ;if not, jump ahead
  1117.                 inc  al                 ;else, scroll 1 more line
  1118. dspline2:       push cx                 ;save string length
  1119.                 push bp                 ;scrolling changes bp
  1120.                 push ax                 ;save num lines scrolled
  1121.                 mov  bh,7               ;attribute of new lines
  1122.                 mov  cx,0000h           ;top left y-x
  1123.                 mov  dx,184fh           ;bottom right y-x
  1124.                 mov  ah,6               ;upwards scroll function
  1125.                 int  10h                ;make the scroll
  1126.                 pop  cx                 ;num lines scrolled in cl
  1127.                 sub  ch,ch              ;clear ch, use cx counter
  1128. dspline3:       sub  di,160             ;screen ptr back 1 line
  1129.                 loop dspline3           ;repeat for ea ln of scrl
  1130.                 pop  bp                 ;restore bp
  1131.                 pop  cx                 ;restore string length
  1132. dspline4:       or   cx,cx              ;test for null string
  1133.                 jnz  dspline5           ;jump if not null
  1134.                 add  di,160             ;increase screen ptr
  1135.                 jmp  dspline9           ;jump and set cursor
  1136. dspline5:       mov  ah,[bp+6]          ;get attribute
  1137.                 lodsb                   ;get a character
  1138.                 cmp  byte ptr[bp+7],0   ;protect against snow?
  1139.                 je   dspline8           ;jump ahead if not
  1140.                 mov  dx,3dah            ;status byte address
  1141.                 mov  bx,ax              ;save char-attri in bx
  1142. dspline6:       in   al,dx              ;get status byte
  1143.                 test al,1               ;test bit
  1144.                 jnz  dspline6           ;loop untill 0
  1145.                 cli                     ;disable interrupts
  1146. dspline7:       in   al,dx              ;get status byte
  1147.                 test al,1               ;test bit
  1148.                 jz   dspline7           ;loop untill 1
  1149.                 mov  ax,bx              ;char-attri back to ax
  1150. dspline8:       stosw                   ;write it with attribute
  1151.                 loop dspline5           ;go do next
  1152.                 sti                     ;reenable interrupts
  1153. dspline9:       mov  ax,di              ;now set new cursor pos
  1154.                 mov  dl,160             ;chars in a y
  1155.                 div  dl                 ;divide scrn ptr
  1156.                 shr  ah,1               ;div remainder by 2
  1157.                 mov  dh,al              ;bios: y in dh
  1158.                 mov  dl,ah              ;x in dl
  1159.                 cmp  dl,0               ;already at new line?
  1160.                 je   dspline10          ;if so, jump ahead
  1161.                 inc  dh                 ;else add 1 more line
  1162.                 mov  dl,0               ;set cursor to x 0
  1163. dspline10:      mov  bh,[bp+8]          ;page number
  1164.                 mov  ah,2               ;function number
  1165.                 int  10h                ;set the cursor
  1166.                 pop  ds                 ;restore ds
  1167.                 pop  bp                 ;restore bp
  1168.                 ret  4
  1169. dspln  endp
  1170.  
  1171.  
  1172. ;-------------------------------------------------------------------------------
  1173. ;procedure dspend(strx: stype; x,y,length,colour :byte;);
  1174. ;-------------------------------------------------------------------------------
  1175. ;
  1176. data    segment
  1177.         extrn  video_buff:word
  1178.         extrn  snow_check :byte
  1179.         extrn  TPFError :byte
  1180. data    ends
  1181. ;
  1182. ;
  1183. dspend proc far
  1184.                 push bp                 ;save bp
  1185.                 mov  bp,sp              ;set stack frame
  1186.                 push ds                 ;ds changed
  1187.                 cld                     ;set direction flag
  1188.                 mov  ax,video_buff      ;fetch video_buff
  1189.                 mov  es,ax              ;es pts to buffer
  1190.                 mov  bl,snow_check      ;get snow_check before change ds
  1191.                 lds  si,dword ptr[bp+14] ;ds:si pts to strx
  1192.                 sub  cx,cx              ;clear cx
  1193.                 mov  cl,[si]            ;string len counted in cx
  1194.                 inc  si                 ;pt si to 1st chr of strx
  1195.                 sub  ax,ax              ;
  1196.                 mov  al,[bp+10]         ;get y value
  1197.                 mov  byte ptr[bp+10],bl ;save snow_check
  1198.                 mov  byte ptr[bp+11],1  ;TPFError 1 = len(strx) > length
  1199.                 dec  ax                 ;count from zero
  1200.                 mov  dl,160             ;160 bytes per line
  1201.                 mul  dl                 ;times number y
  1202.                 sub  dx,dx              ;
  1203.                 mov  dl,[bp+8]          ;move line length to dx
  1204.                 or   dx,dx              ;null?
  1205.                 jz   dspendll1          ;quit if so
  1206.                 mov  byte ptr[bp+11],0  ;else 0 = no error
  1207. dspendll1:      cmp  dx,cx              ;strx shorter?
  1208.                 jnae dspendll2          ;jump ahead if so
  1209.                 sub  dx,cx              ;num chars at end of line
  1210.                 jmp  short dspendll3    ;jump ahead
  1211. dspendll2:      mov  dx,0               ;else draw no extra chars
  1212. dspendll3:      sub  bx,bx              ;
  1213.                 mov  bl,[bp+12]         ;get x value
  1214.                 mov  di,bx              ;
  1215.                 dec  di                 ;count from zero
  1216.                 shl  di,1               ;double for attri bytes
  1217.                 add  di,ax              ;now es:di pts to lst pos
  1218.                 mov  ah,[bp+6]          ;get attribute
  1219.                 jcxz dspendll5          ;jump ahead if strx null
  1220. dspendll4:      lodsb                   ;get a character
  1221.                 call writeit            ;write char and attri
  1222.                 loop dspendll4          ;go do next
  1223. dspendll5:      mov  cx,dx              ;num chars at end of line
  1224.                 mov  al,32              ;space character
  1225.                 jcxz dspendll7          ;jump if none to write
  1226. dspendll6:      call writeit            ;write char and attribute
  1227.                 loop dspendll6          ;go do next
  1228. dspendll7:      pop  ds                 ;restore ds
  1229.                 mov  al,[bp+11]         ;fetch TPFError
  1230.                 mov  TPFError,al       ;set it
  1231.                 pop  bp                 ;restore bp
  1232.                 sti                     ;reenable interrupts
  1233.                 ret  12                 ;return to caller
  1234. dspend endp
  1235.  
  1236.  
  1237.  
  1238. ;-------------------------------------------------------------------------------
  1239. ;procedure dsplncolour(strx: stype; colour :byte;);
  1240. ;-------------------------------------------------------------------------------
  1241. ;
  1242. data    segment
  1243.         extrn  video_buff:word
  1244.         extrn  video_page :byte
  1245.         extrn  snow_check :byte
  1246. data    ends
  1247. ;
  1248. ;
  1249. dsplncolour   proc far
  1250.                 push bp                 ;save bp
  1251.                 mov  bp,sp              ;set stack frame
  1252.                 push ds                 ;ds changed
  1253.                 cld                     ;direction flag forward
  1254.                 mov  ax,video_buff      ;get video buffer address
  1255.                 mov  es,ax              ;place in es
  1256.                 mov  bh,video_page      ;set the cursor page
  1257.                 mov  bl,snow_check      ;fetch snow_check
  1258.                 mov  ah,3               ;bios func for cursor pos
  1259.                 int  10h                ;now dh-dl holds y-x
  1260.                 lds  si,dword ptr[bp+8] ;ds:si pts to strx
  1261.                 mov  [bp+8],bx          ;save video_page and snow_check
  1262.                 sub  cx,cx              ;clear cx
  1263.                 mov  cl,[si]            ;string len counted in cx
  1264.                 inc  si                 ;now ds:si pts to strx
  1265.                 mov  ax,160             ;cursor pos :byte;s in y
  1266.                 mul  dh                 ;multiply by num y
  1267.                 sub  dh,dh              ;now dx holds num cols
  1268.                 shl  dx,1               ;double for attri bytes
  1269.                 add  ax,dx              ;cursor offset in buffer
  1270.                 mov  di,ax              ;now es:di pts to pos
  1271.                 mov  bx,3840            ;scrl if won't fit y 24
  1272.                 sub  bx,di              ;space left
  1273.                 mov  ax,cx              ;chars to be printed
  1274.                 shl  ax,1               ;double for attributes
  1275.                 or   cx,cx              ;test for null string
  1276.                 jnz  dsplnc1            ;jump if not null
  1277.                 cmp  di,3840            ;last y?
  1278.                 jnge dsplnc1            ;jump if not
  1279.                 mov  al,1               ;scroll if null on y 25
  1280.                 jmp  short dsplnc2      ;jump ahead
  1281. dsplnc1:        cmp  bx,ax              ;enough room?
  1282.                 jge  dsplnc4            ;jump ahead if so
  1283.                 sub  ax,bx              ;amount space required
  1284.                 mov  bl,160             ;bytes in a y
  1285.                 div  bl                 ;divide
  1286.                 cmp  ah,0               ;any remainder?
  1287.                 je   dsplnc2            ;if not, jump ahead
  1288.                 inc  al                 ;else, scroll 1 more line
  1289. dsplnc2:        push cx                 ;save string length
  1290.                 push bp                 ;scrolling changes bp
  1291.                 push ax                 ;save num lines scrolled
  1292.                 mov  bh,[bp+6]          ;attribute of new lines
  1293.                 mov  cx,0000h           ;top left y-x
  1294.                 mov  dx,184fh           ;bottom right y-x
  1295.                 mov  ah,6               ;upwards scroll function
  1296.                 int  10h                ;make the scroll
  1297.                 pop  cx                 ;num lines scrolled in cl
  1298.                 sub  ch,ch              ;clear ch, use cx counter
  1299. dsplnc3:        sub  di,160             ;screen ptr back 1 line
  1300.                 loop dsplnc3            ;repeat for ea ln of scrl
  1301.                 pop  bp                 ;restore bp
  1302.                 pop  cx                 ;restore string length
  1303. dsplnc4:        or   cx,cx              ;test for null string
  1304.                 jnz  dsplnc5            ;jump if not null
  1305.                 add  di,160             ;increase screen ptr
  1306.                 jmp  dsplnc10           ;jump and set cursor
  1307. dsplnc5:        mov  ah,[bp+6]          ;get attribute
  1308. dsplnc6:        lodsb                   ;get a character
  1309.                 mov  dx,es              ;get video buffer address
  1310.                 cmp  byte ptr[bp+8],0   ;protect against snow?
  1311.                 je   dsplnc9            ;jump ahead if not
  1312.                 mov  dx,3dah            ;status byte address
  1313.                 mov  bx,ax              ;save ax contents
  1314. dsplnc7:        in   al,dx              ;get status byte
  1315.                 test al,1               ;test bit
  1316.                 jnz  dsplnc7            ;loop untill 0
  1317.                 cli                     ;disable interrupts
  1318. dsplnc8:        in   al,dx              ;get status byte
  1319.                 test al,1               ;test bit
  1320.                 jz   dsplnc8            ;loop untill 1
  1321.                 mov  ax,bx              ;char/attri back to ax
  1322. dsplnc9:        stosw                   ;write it with attribute
  1323.                 loop dsplnc6            ;go do next
  1324.                 sti                     ;reenable interrupts
  1325. dsplnc10:       mov  ax,di              ;now set new cursor pos
  1326.                 mov  dl,160             ;chars in a y
  1327.                 div  dl                 ;divide scrn ptr
  1328.                 shr  ah,1               ;div remainder by 2
  1329.                 mov  dh,al              ;bios: y in dh
  1330.                 mov  dl,ah              ;x in dl
  1331.                 cmp  dl,0               ;already at new line?
  1332.                 je   dsplnc11           ;if so, jump ahead
  1333.                 inc  dh                 ;else add 1 more line
  1334.                 mov  dl,0               ;set cursor to x 0
  1335. dsplnc11:       mov  bh,[bp+9]          ;page number
  1336.                 mov  ah,2               ;function number
  1337.                 int  10h                ;set the cursor
  1338.                 pop  ds                 ;restore ds
  1339.                 pop  bp                 ;restore bp
  1340.                 ret  6
  1341. dsplncolour   endp
  1342.  
  1343.  
  1344. ;-------------------------------------------------------------------------------
  1345. ;procedure dsppart(strx: stype; start,numch,x,y,colour :byte;);
  1346. ;-------------------------------------------------------------------------------
  1347. ;
  1348. data    segment
  1349.         extrn  video_buff:word
  1350.         extrn  snow_check :byte
  1351.         extrn  TPFError :byte
  1352. data    ends
  1353. ;
  1354. ;
  1355. ;
  1356. dsppart proc far
  1357.                 push bp                 ;save bp
  1358.                 mov  bp,sp              ;set stack frame
  1359.                 mov  cl,snow_check      ;get snow_check
  1360.                 push ds                 ;save turbo's ds
  1361.                 mov  ax,video_buff      ;fetch video_buff
  1362.                 mov  es,ax              ;es pts to buffer
  1363.                 sub  bx,bx              ;
  1364.                 mov  bl,[bp+8]          ;y
  1365.                 dec  bx                 ;count from zero
  1366.                 mov  [bp+8],cl          ;save snow_check
  1367.                 sub  cx,cx              ;
  1368.                 mov  cl,[bp+10]         ;x
  1369.                 dec  cx                 ;count from zero
  1370.                 mov  ax,160             ;bytes per y
  1371.                 mul  bl                 ;y offset
  1372.                 shl  cx,1               ;dble cols for attributes
  1373.                 add  ax,cx              ;offset to start position
  1374.                 mov  di,ax              ;es:di pts to start
  1375.                 lds  si,dword ptr[bp+16] ;ds:si pts to strx
  1376.                 sub  cx,cx              ;clear cx
  1377.                 mov  cl,[si]            ;get string descriptor
  1378.                 mov  bh,1               ;error code 1 = null strx
  1379.                 jcxz displaypartl7      ;quit if null
  1380.                 mov  al,[bp+14]         ;startpoint
  1381.                 inc  bh                 ;2 = start outside of string
  1382.                 cmp  al,cl              ;start point in range?
  1383.                 jnbe displaypartl7      ;quit if not
  1384.                 or   al,al              ;test for zero
  1385.                 jz   displaypartl7      ;
  1386.                 inc  bh                 ;3 = not enough room for numch
  1387.                 cmp  byte ptr[bp+12],0  ;check for numch nonzero
  1388.                 jz   displaypartl7      ;quit if zero
  1389.                 mov  ah,al              ;copy startpoint
  1390.                 add  ah,[bp+12]         ;add number chars
  1391.                 dec  ah                 ;adjust
  1392.                 cmp  ah,cl              ;in range?
  1393.                 jna  displaypartl1      ;jump ahead if ok
  1394.                 sub  cl,[bp+14]         ;number chars to write
  1395.                 inc  cl                 ;adjust
  1396.                 jmp  short displaypartl2 ;
  1397. displaypartl1:  mov  cl,[bp+12]         ;num chars to write
  1398.                 sub  bh,bh              ;0 = no error
  1399. displaypartl2:  sub  ah,ah              ;extend byte value
  1400.                 add  si,ax              ;offset string ptr
  1401.                 cld                     ;forward direction
  1402.                 mov  ah,[bp+6]          ;get screen attribute
  1403. displaypartl3:  lodsb                   ;get a char from strx
  1404.                 cmp  byte ptr[bp+8],0   ;protect against snow?
  1405.                 je   displaypartl6      ;jump if not
  1406.                 push ax                 ;save char-attri
  1407.                 mov  dx,3dah            ;status byte address
  1408. displaypartl4:  in   al,dx              ;get status byte
  1409.                 test al,1               ;test bit
  1410.                 jnz  displaypartl4      ;loop untill 0
  1411.                 cli                     ;disable interrupts
  1412. displaypartl5:  in   al,dx              ;get status byte
  1413.                 test al,1               ;test bit
  1414.                 jz   displaypartl5      ;loop untill 1, then write
  1415.                 pop  ax                 ;restore char-attri
  1416. displaypartl6:  stosw                   ;write the char and colour
  1417.                 loop displaypartl3      ;loop untill finished
  1418. displaypartl7:  sti                     ;reenable interrupts
  1419.                 pop  ds                 ;restore ds and quit
  1420.                 mov  TPFError,bh       ;set TPFError
  1421.                 pop  bp                 ;restore bp
  1422.                 ret  14
  1423. dsppart endp
  1424.  
  1425.  
  1426. ;-------------------------------------------------------------------------------
  1427. ;procedure dspjust(strx: stype; x,y,colour :byte;);
  1428. ;-------------------------------------------------------------------------------
  1429. ;
  1430. data    segment
  1431.         extrn  video_buff:word
  1432.         extrn  snow_check :byte
  1433. data    ends
  1434. ;
  1435. ;
  1436. dspjust proc far
  1437.                 push bp                 ;save bp
  1438.                 mov  bp,sp              ;set stack frame
  1439.                 mov  cl,snow_check      ;get snow_check
  1440.                 push ds                 ;save turbo's ds
  1441.                 mov  ax,video_buff      ;fetch video_buff
  1442.                 mov  es,ax              ;es pts to buffer
  1443.                 sub  bx,bx              ;
  1444.                 mov  bl,[bp+8]          ;y
  1445.                 dec  bx                 ;count from zero
  1446.                 mov  byte ptr[bp+8],cl  ;save snow_check
  1447.                 sub  cx,cx              ;
  1448.                 mov  cl,[bp+10]         ;x
  1449.                 dec  cx                 ;count from zero
  1450.                 mov  ax,160             ;bytes per y
  1451.                 mul  bl                 ;y offset
  1452.                 shl  cx,1               ;dble cols for attributes
  1453.                 add  ax,cx              ;offset to start position
  1454.                 mov  di,ax              ;es:di pts to start
  1455.                 lds  si,dword ptr[bp+12] ;ds:si pts to strx
  1456.                 sub  cx,cx              ;clear cx
  1457.                 mov  cl,[si]            ;get string descriptor
  1458.                 jcxz dspjust5           ;quit if null
  1459.                 add  si,cx              ;pt to end of strx
  1460.                 std                     ;reverse direction
  1461.                 mov  ah,[bp+6]          ;get screen attribute
  1462. dspjust1:       lodsb                   ;get a char from strx
  1463.                 cmp  byte ptr[bp+8],0   ;protect against snow?
  1464.                 je   dspjust4           ;jump if not
  1465.                 mov  bx,ax              ;save char-attri in bx
  1466.                 mov  dx,3dah            ;status byte address
  1467. dspjust2:       in   al,dx              ;get status byte
  1468.                 test al,1               ;test bit
  1469.                 jnz  dspjust2           ;loop untill 0
  1470.                 cli                     ;disable interrupts
  1471. dspjust3:       in   al,dx              ;get status byte
  1472.                 test al,1               ;test bit
  1473.                 jz   dspjust3           ;loop untill 1, then write
  1474.                 mov  ax,bx              ;return char/attri to ax
  1475. dspjust4:       stosw                   ;write the char and colour
  1476.                 loop dspjust1           ;loop untill finished
  1477. dspjust5:       sti                     ;reenable interrupts
  1478.                 pop  ds                 ;restore ds and quit
  1479.                 pop  bp                 ;restore bp
  1480.                 ret  10
  1481. dspjust endp
  1482.  
  1483.  
  1484. ;-------------------------------------------------------------------------------
  1485. ;procedure dspvert(strx: stype; x,y,colour :byte;);
  1486. ;-------------------------------------------------------------------------------
  1487. ;
  1488. data    segment
  1489.         extrn  video_buff:word
  1490.         extrn  snow_check :byte
  1491. data    ends
  1492. ;
  1493. ;
  1494. dspvert proc far
  1495.                 cld                     ;direction flag forward
  1496.                 push bp                 ;bp altered
  1497.                 mov  bp,sp              ;set stack frame
  1498.                 push ds                 ;save ds
  1499.                 mov  ax,video_buff      ;fetch video_buff
  1500.                 mov  es,ax              ;es points to buffer
  1501.                 mov  bl,snow_check      ;fetch snow_check before ds change
  1502.                 lds  si,dword ptr[bp+12] ;ds:si pts to strx
  1503.                 mov  [bp+12],bl         ;save snow_check
  1504.                 sub  ax,ax              ;
  1505.                 mov  al,[bp+8]          ;y to ax
  1506.                 dec  ax                 ;count from 0
  1507.                 mov  dl,160             ;bytes per y
  1508.                 mul  dl                 ;times y
  1509.                 sub  dx,dx              ;
  1510.                 mov  dl,[bp+10]         ;column to dx
  1511.                 dec  dx                 ;count from 0
  1512.                 shl  dx,1               ;double for attributes
  1513.                 add  ax,dx              ;add to y offset
  1514.                 mov  di,ax              ;es:di pts to screen
  1515.                 mov  ah,[bp+6]          ;attribute to ah
  1516.                 sub  cx,cx              ;clear cx
  1517.                 mov  cl,[si]            ;string length to cx
  1518.                 jcxz dspvertical5       ;quit if null
  1519. dspvertical1:   inc  si                 ;inc string pointer
  1520.                 mov  al,[si]            ;char to al
  1521.                 cmp  byte ptr[bp+12],0  ;protect against snow?
  1522.                 je   dspvertical4       ;jump ahead if not
  1523.                 mov  dx,3dah            ;status byte address
  1524.                 mov  bx,ax              ;save char-attri in bx
  1525. dspvertical2:   in   al,dx              ;get status byte
  1526.                 test al,1               ;test bit
  1527.                 jnz  dspvertical2       ;loop untill 0
  1528.                 cli                     ;disable interrupts
  1529. dspvertical3:   in   al,dx              ;get status byte
  1530.                 test al,1               ;test bit
  1531.                 jz   dspvertical3       ;loop untill 1
  1532.                 mov  ax,bx              ;return char-attri to ax
  1533. dspvertical4:   stosw                   ;write the char & attri
  1534.                 add  di,158             ;ptr to next y
  1535.                 loop dspvertical1       ;go write next char
  1536. dspvertical5:   sti                     ;reenable interrupts
  1537.                 pop  ds                 ;restore ds
  1538.                 pop  bp                 ;restore bp and quit
  1539.                 ret  10
  1540. dspvert endp
  1541.  
  1542.  
  1543.  
  1544. ;-------------------------------------------------------------------------------
  1545. ;function getpage :integer;
  1546. ;-------------------------------------------------------------------------------
  1547. ;
  1548. getpage proc far
  1549.                 mov  ah,0fh             ;function number
  1550.                 int  10h                ;get the current page
  1551.                 mov  al,bh              ;shift page num to al
  1552.                 sub  ah,ah              ;clear ah
  1553.                 ret
  1554. getpage endp
  1555.  
  1556. ;-------------------------------------------------------------------------------
  1557. ;procedure swappage(box :pointer; pagenumber :byte;);
  1558. ;-------------------------------------------------------------------------------
  1559. ;
  1560. swappage proc far
  1561.                 push bp                         ;save bp
  1562.                 mov  bp,sp                      ;set stack frame
  1563.                 push ds                         ;save ds
  1564.                 mov  bl,snow_check              ;fetch snow_check
  1565.                 cld                             ;set direction flag
  1566.                 mov  cx,video_buff              ;get video buffer addr
  1567.                 mov  dl,[bp+6]                  ;get page number
  1568.                 mov  ax,1000h                   ;page size
  1569.                 mul  dl                         ;times number pages
  1570.                 add  ax,cx                      ;add to buffer offset
  1571.                 mov  es,ax                      ;es pts to page
  1572.                 lds  si,dword ptr[bp+8]         ;ds:si pts to byte array
  1573.                 mov  cx,2000                    ;number words to exchange
  1574.                 sub  di,di                      ;point di to 0 offset
  1575.                 cmp  bl,0                       ;snow_check?
  1576.                 je   swappagel1                 ;jump if not
  1577.                 mov  dx,3d8h                    ;cga mode select register
  1578.                 mov  al,25h                     ;shuts off screen
  1579.                 out  dx,al                      ;disable video
  1580. swappagel1:     mov  ax,es:[di]                 ;get video word
  1581.                 xchg ax,[si]                    ;xchg with word in box
  1582.                 stosw                           ;move box word to screen
  1583.                 add  si,2                       ;forward box ptr
  1584.                 loop swappagel1                 ;go do next word
  1585.                 cmp  bl,0                       ;snow protect?
  1586.                 je   swappagel2                 ;jump ahead if not
  1587.                 mov  dx,3d8h                    ;cga mode select register
  1588.                 mov  al,41                      ;80x25, blink enabled
  1589.                 out  dx,al                      ;reenable video
  1590. swappagel2:     pop  ds                         ;restore ds
  1591.                 pop  bp                         ;restore bp
  1592.                 ret  6
  1593. swappage endp
  1594.  
  1595. ;-------------------------------------------------------------------------------
  1596. ;procedure clearpage(pagenumber,colour :byte;);
  1597. ;-------------------------------------------------------------------------------
  1598. ;
  1599. clearpage proc far
  1600.                 push bp                         ;save bp
  1601.                 mov  bp,sp                      ;set stack frame
  1602.                 mov  bh,[bp+8]                  ;page number to bh
  1603.                 mov  ah,2                       ;bios func to set cursor
  1604.                 sub  dx,dx                      ;y and column are 0,0
  1605.                 int  10h                        ;set the cursor
  1606.                 mov  ah,9                       ;bios write function
  1607.                 mov  al,32                      ;clear with space char
  1608.                 mov  bl,[bp+6]                  ;attribute to bl
  1609.                 mov  cx,2000                    ;chars to write
  1610.                 int  10h                        ;clear the page
  1611.                 pop  bp                         ;restore bp
  1612.                 ret  4
  1613. clearpage endp
  1614.  
  1615. code    ends
  1616.         end
  1617.  
  1618.